{! extends name="home/base" !}


{! block name="content" !}
<div class="posts pure-u-1 pure-u-md-1">

    <header class="post-header">

        <h2 class="post-title">{=$info['title']}</h2>

        <p class="post-meta">
            时间: {=$info['create_at']} &nbsp; 标签: 

{! for $info['tags'] as $key => $tag !}
        <a href="/post_search?tags={=$tag['tid']}" class="post-category"><span>{=$tag['name']}</span></a>
{! endfor !}

        </p>
    </header>

    <div class="post-description" style="padding: 30px 10px 50px 10px;">
        {=$info['content_html']}
    </div>

    <div class="post-nav">
    	<ul>
    	<li class="fl"><a href="{=$prev['link']}"><span>上一篇: {=$prev['title']} </span></a></li>
    	<li class="fr"><a href="{=$next['link']}"><span>下一篇: {=$next['title']} </span></a></li>
    	<li class="clear"></li>
    	</ul>
    </div>
</div>

<div class="comment pure-u-1 pure-u-md-1">
	<div class="comment-list">

{! for $comments as $key => $comment !}
		<div class="comment-item pure-g">
            <div class="pure-u-3-4">
            	<p><b>{=$comment['name']}</b> &nbsp; <small>发表于: {=$comment['create_at']}</small></p>
                <p class="comment-desc">
                	{=$comment['comment']}
                </p>
            </div>
        </div>
{! endfor !}

	</div>

	<div class="comment-post">
		<form class="pure-form" method="POST" action="/comment">
            {=$csrf_field}
            <input type="hidden" name="pid" value="{=$info['id']}">
	    <fieldset class="pure-group">
	        <input type="text" class="pure-input-1-2" placeholder="名字" name="name">
	        <input type="email" class="pure-input-1-2" placeholder="Email" name="email">
	        <textarea class="pure-input-1-2" placeholder="你的发言,不支持HTML" name="comment"></textarea>
	    </fieldset>
		<button type="submit" class="pure-button pure-button-primary">发表评论</button>
	</form>
	</div>
</div>
{! endblock !}